var express = require('express');
var router = express.Router();
var { user } = require('../dao/index')
/* GET users listing. */
router.get('/', function (req, res, next) {
  console.log(req.query)
  user.findById(req.query.id, function (err,data) {
    if (!err) {
      res.json(data)
    }
  })
});

router.post('/update', function (req, res, next) {
  user.findByIdAndUpdate(req.body._id,req.body,function(err,data){
    if (err) {
      res.json({
        status: false,
        err:'更新失败'
      })
    } else {
      res.json({
        status: true,
        lay:'更新成功'
      })
    }
  })
})
module.exports = router;
